package com.dfbz.utils;

import com.mysql.jdbc.StringUtils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class XBUtils {
    public static Cookie getCookie(HttpServletRequest request,  String cookieName){
        if(request.getCookies()!=null&&!StringUtils.isNullOrEmpty(cookieName)){
            for (Cookie cookie : request.getCookies()) {
                if(cookie.getName().equals(cookieName)){
                    return cookie;
                }
            }
        }
        return null;
    }
}
